package org.gocom.components.coframe.tools;

import java.io.IOException;

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.eos.engine.component.ILogicComponent;
import com.eos.system.annotation.Bizlet;
import com.primeton.ext.engine.component.LogicComponentFactory;
@Bizlet("")
public class SectionBuild implements Servlet{

	public static Object[] labelBank ;
	//所有部门树形菜单
	public static Object[] result ;
	//到L2部门树形菜单
	public static Object[] resultL2 ;
	public void destroy() {
		
		
	}

	public ServletConfig getServletConfig() {
		
		return null;
	}

	public String getServletInfo() {
		
		return null;
	}

	public void init(ServletConfig arg0) throws ServletException {
		section();
		sectionL2();
	}

	public void service(ServletRequest arg0, ServletResponse arg1)
			throws ServletException, IOException {
		
		
	}
	public static void  section() {
		Object[] params = new Object[1];
		params[0] = 1;
		// 逻辑构件名称
					String componentName = "org.gocom.components.coframe.tools.PlugIn";
					// 逻辑流名称
					String operationName = "sectionPlugIn";
					ILogicComponent logicComponent = LogicComponentFactory.create(componentName);
        try {
			result = logicComponent.invoke(operationName, params);
		} catch (Throwable e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
	}
	public static void  sectionL2() {
		Object[] params = new Object[1];
		params[0] = 1;
		// 逻辑构件名称
					String componentName = "org.gocom.components.coframe.tools.departmentPlugIn";
					// 逻辑流名称
					String operationName = "queryL2";
					ILogicComponent logicComponent = LogicComponentFactory.create(componentName);
        try {
        	resultL2 = logicComponent.invoke(operationName, params);
		} catch (Throwable e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
		}
	}
	@Bizlet("")
	public Object[] Build(){
		if(result!=null){
			
		}else{
			section();
		}
		return result;
		
	}
	@Bizlet("")
	public Object[] BuildL2(){
		if(resultL2!=null){
			
		}else{
			sectionL2();
		}
		return resultL2;
		
	}
	//更新部门json信息
	@Bizlet("")
	public void queryBuild(){
		section();
	}
	
	//更新部门json信息
		@Bizlet("")
		public void queryBuildL2(){
			sectionL2();
		}
		@Bizlet("")
		public String likeString(String string){
			if(string!="" && string!=null){
				string = "%"+string+"%";
			}
			return string;
		}
		
}
